'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 getlight.
.ds Xs 45912 8 getlight.gl
.TH GLGETLIGHT 3G
.SH NAME
.B "glGetLightfv, glGetLightiv
\- return light source parameter values

.SH C SPECIFICATION
void \f3glGetLightfv\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglGetLightfv( 'u
	GLenum \fIpname\fP,
	GLfloat \fI*params\fP )
.fi
void \f3glGetLightiv\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglGetLightiv( 'u
	GLenum \fIpname\fP,
	GLint \fI*params\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIparams\fP\ \ 'u 
\f2light\fP
Specifies a light source.
The number of possible lights depends on the implementation,
but at least eight lights are supported.
They are identified by symbolic names of the form \%\f3GL_LIGHT\fP$i$
where 0 \(<= $ i $ < \%\f3GL_MAX_LIGHTS\fP.
.TP
\f2pname\fP
Specifies a light source parameter for \f2light\fP.
Accepted symbolic names are
\%\f3GL_AMBIENT\fP,
\%\f3GL_DIFFUSE\fP,
\%\f3GL_SPECULAR\fP,
\%\f3GL_POSITION\fP,
\%\f3GL_SPOT_DIRECTION\fP,
\%\f3GL_SPOT_EXPONENT\fP,
\%\f3GL_SPOT_CUTOFF\fP,
\%\f3GL_CONSTANT_ATTENUATION\fP,
\%\f3GL_LINEAR_ATTENUATION\fP, and
\%\f3GL_QUADRATIC_ATTENUATION\fP.
.TP
\f2params\fP
Returns the requested data.
.SH DESCRIPTION
\%\f3glGetLight\fP returns in \f2params\fP the value or values of a light source parameter.
\f2light\fP names the light and is a symbolic name of the form \%\f3GL_LIGHT\fP$i$
for 0 \(<= $i$ < \%\f3GL_MAX_LIGHTS\fP,
where \%\f3GL_MAX_LIGHTS\fP is an implementation dependent constant that is
greater than or equal to eight.
\f2pname\fP specifies one of ten light source parameters,
again by symbolic name.
.P
The following parameters are defined:
.TP 20
\%\f3GL_AMBIENT\fP
\f2params\fP returns four integer or floating-point values representing the
ambient intensity of the light source.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value is
(0, 0, 0, 1). 
.TP
\%\f3GL_DIFFUSE\fP
\f2params\fP returns four integer or floating-point values representing the
diffuse intensity of the light source.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value
for \%\f3GL_LIGHT0\fP is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0). 
.TP
\%\f3GL_SPECULAR\fP
\f2params\fP returns four integer or floating-point values representing the
specular intensity of the light source.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value
for \%\f3GL_LIGHT0\fP is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0).
.TP
\%\f3GL_POSITION\fP
\f2params\fP returns four integer or floating-point values representing the
position of the light source.
Integer values,
when requested,
are computed by rounding the internal floating-point values to the
nearest integer value.
The returned values are those maintained in eye coordinates.
They will not be equal to the values specified using \%\f3glLight\fP,
unless the modelview matrix was identity at the time \%\f3glLight\fP was
called. The initial value is (0, 0, 1, 0).
.TP
\%\f3GL_SPOT_DIRECTION\fP
\f2params\fP returns three integer or floating-point values representing the
direction of the light source.
Integer values,
when requested,
are computed by rounding the internal floating-point values to the
nearest integer value.
The returned values are those maintained in eye coordinates.
They will not be equal to the values specified using \%\f3glLight\fP,
unless the modelview matrix was identity at the time \%\f3glLight\fP was called.
Although spot direction is normalized before being used in the lighting
equation,
the returned values are the transformed versions of the specified values
prior to normalization. The initial value is (0, 0, \-1).
.TP
\%\f3GL_SPOT_EXPONENT\fP
\f2params\fP returns a single integer or floating-point value representing the
spot exponent of the light.
An integer value,
when requested,
is computed by rounding the internal floating-point representation to
the nearest integer. The initial value is 0. 
.TP
\%\f3GL_SPOT_CUTOFF\fP
\f2params\fP returns a single integer or floating-point value representing the
spot cutoff angle of the light.
An integer value,
when requested,
is computed by rounding the internal floating-point representation to
the nearest integer. The initial value is 180. 
.TP
\%\f3GL_CONSTANT_ATTENUATION\fP
\f2params\fP returns a single integer or floating-point value representing the
constant (not distance-related) attenuation of the light.
An integer value,
when requested,
is computed by rounding the internal floating-point representation to
the nearest integer. The initial value is 1. 
.TP
\%\f3GL_LINEAR_ATTENUATION \fP
\f2params\fP returns a single integer or floating-point value representing the
linear attenuation of the light.
An integer value,
when requested,
is computed by rounding the internal floating-point representation to
the nearest integer. The initial value is 0. 
.TP
\%\f3GL_QUADRATIC_ATTENUATION\fP
\f2params\fP returns a single integer or floating-point value representing the
quadratic attenuation of the light.
An integer value,
when requested,
is computed by rounding the internal floating-point representation to
the nearest integer. The initial value is 0. 
.SH NOTES
It is always the case that \%\f3GL_LIGHT\fP$i$ = \%\f3GL_LIGHT0\fP + $i$.
.P
If an error is generated,
no change is made to the contents of \f2params\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2light\fP or \f2pname\fP is not an
accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glGetLight\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH SEE ALSO
\%\f3glLight(3G)\fP
